home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- (*
- Shareware. Send Check or Moneyorder of $49 to:
- Jan Dekkers, 11956 Riverside Dr. 206
- N. Hollywood CA 91607.
-
- (c) 1995 by:
-
- Kevin Adams (CIS) 74742,1444
- Jan Dekkers (CIS) 72130,353
-
- This DLL will display a reminder after the 5th picture is displayed.
-
- Registering this software will motivate us to finish the remaining image
- library which will include GIF and PCX support. Registered users will
- receive a VCL interface derived of TImage free of charge in 1 about month.
-
- Happy coding.
-
- Kevin Adams Jan Dekkers
-
-
- Make sure that your program can access the DLL
-
- By the way: This delphi example is not invalidating the TImage
- correctly so that the seccond picture displayed still has garbage
- of the first picture in it. This has nothing to do with the DLL
- but with the way this Delphi sample is put together.
-
- *)
-
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, ExtCtrls, JpgImage, Menus, StdCtrls;
-
- var
- res, {resolution}
- scale, {size}
- dither : Integer; {dither method}
- Bitmap : TBitmap;
-
- type
- TForm1 = class(TForm)
- ScrollBox1: TScrollBox;
- Image1: TImage;
- MainMenu1: TMainMenu;
- OpenDialog1: TOpenDialog;
- File1: TMenuItem;
- Open1: TMenuItem;
- GroupBox1: TGroupBox;
- Radio4: TRadioButton;
- Radio8: TRadioButton;
- Radio24: TRadioButton;
- GroupBox2: TGroupBox;
- DithRadio24: TRadioButton;
- DithOnepassRadio: TRadioButton;
- DithOnepassOrderedRadio: TRadioButton;
- DithTwopassRadio: TRadioButton;
- DithTwopassFSRadio: TRadioButton;
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure Open1Click(Sender: TObject);
- procedure DithRadio24Click(Sender: TObject);
- private
- { Private declarations }
- procedure OpenJpeg(fname : String);
- Function GetDithering : Integer;
- Function GetResolution : Integer;
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- {}
- end;
-
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- Action := caFree;
- end;
-
- procedure TForm1.Open1Click(Sender: TObject);
- begin
- If OpenDialog1.Execute then
- OpenJpeg(OpenDialog1.FileName);
- end;
-
- procedure TForm1.OpenJpeg(fname : String);
- begin
- res := GetResolution;
- { res: 8 - 8 bit, 24 - 24 bit, 4 - 4 bit
- 8 = 256 colors, 24 = true color, 4 = 16 colors}
-
- dither := GetDithering;
- { dither: 0 = 24 bit bitmap
- 1 = One pass no dithering
- 2 = one pass ordered dithering
- 3 = two pass no dithering
- 4 = two pass FS dithering}
-
- scale := 1;
- { scale: 1 = 1/1, 2 = 1/2, 4 = 1/4, 8 = 1/8 size of image}
-
- Bitmap := TBitmap.Create;
- jpgfile(fname, res, scale, dither, Bitmap);
- Image1.Picture.Bitmap := Bitmap;
- Bitmap.Free;
- end;
-
-
- Function TForm1.GetDithering : Integer;
- var r : integer;
- begin
- if DithRadio24.Checked then r:=0 else
- if DithOnepassRadio.Checked then r:=1 else
- if DithOnepassOrderedRadio.Checked then r:=2 else
- if DithTwopassRadio.Checked then r:=3 else
- if DithTwopassFSRadio.Checked then r:=4;
- GetDithering:=r;
- end;
-
- Function TForm1.GetResolution : Integer;
- var r : integer;
- begin
- if Radio4.Checked then r:=4 else
- if Radio8.Checked then r:=8 else
- if Radio24.Checked then r:=24;
- GetResolution:=r;
- end;
-
- procedure TForm1.DithRadio24Click(Sender: TObject);
- begin
- if DithRadio24.Checked then Radio24.Checked:=True;
- end;
-
- end.
-